<template>
  <div id="left">
    <div>
      <div class="user-info">
        <img :src="imgUrl" width="100%" height="230" alt="" style="border-radius: 5px 5px 0 0;">
        <div class="info radius-bottom">
          <div class="list"><h1>曾小晨</h1></div>
          <div class="list"><span style="font-size: 12px">实习前端工程师</span></div>
          <div class="list"><span style="font-size: 12px">一枚文艺青年</span></div>
          <div class="list">
            <font-awesome-icon :icon="['fab','qq']" class="qq"/>
            <font-awesome-icon :icon="['fab','github']" class="github"/>
            <font-awesome-icon :icon="['fab','weixin']" class="wechat"/>
            <font-awesome-icon :icon="['fab','weibo']" class="weibo"/>
          </div>
          <div style="margin: 10px;">
            <el-input
              size="mini"
              placeholder="请输入内容"
              suffix-icon="el-icon-search">
            </el-input>
          </div>
        </div>
      </div>

      <el-menu
        :unique-opened="true"
        class="el-menu-vertical-demo"
        @open="handleOpen"
        @close="handleClose"
        active-text-color="#409eff" style="border-top: 1px solid #f2f2f2">
        <el-submenu index="1">
          <template slot="title">
            <font-awesome-icon :icon="['fas','paper-plane']" class="nav-icon"/>
            <span>页面穿梭</span>
          </template>
          <router-link :to="{path: '/article/list'}">
            <el-menu-item index="1-1">首页</el-menu-item>
          </router-link>
          <router-link :to="{path: '/article/list'}">
            <el-menu-item index="1-2">归档</el-menu-item>
          </router-link>
          <router-link :to="{path: '/article/list'}">
            <el-menu-item index="1-3">邻居</el-menu-item>
          </router-link>
        </el-submenu>
        <el-menu-item index="2">
          <i class="el-icon-menu"></i>
          <span slot="title">关于博主</span>
        </el-menu-item>
        <router-link :to="{path: '/image'}">
          <el-menu-item index="3">
            <font-awesome-icon :icon="['fas','image']" class="nav-icon"/>
            我的图册
            <!--<span slot="title">我的图册</span>-->
          </el-menu-item>
        </router-link>
        <!--<router-link :to="{path: '/problem/list'}">-->
        <!--<el-menu-item index="4">-->
        <!--<font-awesome-icon :icon="['fas','question']" class="nav-icon"/>-->
        <!--<span slot="title">问题搜集</span>-->
        <!--</el-menu-item>-->
        <!--</router-link>-->

        <el-submenu index="4">
          <template slot="title">
            <font-awesome-icon :icon="['fas','question']" class="nav-icon"/>
            <span>问题搜集</span>
          </template>
          <router-link :to="{path: '/problem/list'}">
            <el-menu-item index="4-1">问题列表</el-menu-item>
          </router-link>
          <router-link :to="{path: '/problem/create'}">
            <el-menu-item index="4-2">我要提问</el-menu-item>
          </router-link>
        </el-submenu>
      </el-menu>
    </div>
  </div>
</template>

<script lang="ts">
  import {Component, Model, Prop, Vue} from 'vue-property-decorator'

  @Component
  export default class Left extends Vue {
    imgUrl: string = "http://imain.net/usr/uploads/2018/02/1254835428.png";

    handleOpen(key, keyPath) {
      console.log(key, keyPath);
    };

    handleClose(key, keyPath) {
      console.log(key, keyPath);
    }
  }
</script>

<style lang="scss">
  @import "../../assets/scss/config";
  /*@import "../../assets/scss/common";*/

  #left {

    & > div {
      border-radius: 5px;
      background: #fff;
      margin: 15px 0;
      padding-bottom: 10px;
      height: 100%;
      overflow-y: auto;
      position: fixed;
      top: 0;
    }

    ::-webkit-scrollbar {
      width: 0;
    }

    h1 {
      font-weight: 600;
    }
    width: $left-width;
    .user-info {
      /*box-shadow: 0 0 6px 0 rgba(0, 0, 0, 0.6);*/
      /*border-radius: 5px;*/
      width: 198px;
      .info {
        text-align: center;
        width: 100%;
        margin-left: auto;
        overflow: auto;
        color: #000;
        svg {
          margin-right: 5px;
          transition: all .3s;
          cursor: pointer;
        }
        .list {
          margin: 10px 0;
          span {
            /*display: inline-block;*/
            border-bottom: 1px solid;
          }
        }
        .qq {
          &:hover {
            color: #5387d1;
          }
        }
        .wechat {
          &:hover {
            color: #51d10c;
          }
        }
        .weibo {
          &:hover {
            color: #d10e12;
          }
        }
      }
    }
    .el-submenu .el-menu-item {
      min-width: auto;
    }

    .el-menu {
      border-right: 0;
    }

    .nav-icon {
      margin-right: 5px;
      width: 24px;
      text-align: center;
      vertical-align: middle;
      color: #909399;
    }
  }
</style>
